<template>
  <view
    class="p-2 flex align-center flex-column justify-center"
    style="height: 80vh"
  >
    <!-- 客服中心 -->
    <view class="flex flex-column align-center">
      <image
        style="width: 350rpx"
        :src="Domain_ICON + '/serve.png'"
        mode="widthFix"
      ></image>
      <view
        @click="goserve('/pages/serves/serves')"
        class="text-white bg-info font-sm mt-3"
        style="
          border-radius: 25rpx;
          text-align: center;
          width: 350rpx;
          height: 50rpx;
          line-height: 50rpx;
        "
      >
        在线客服
      </view>
      <!-- <view @click="callPhone" class="text-info font-sm mt-3" style="border: 2rpx solid #17a2b8;border-radius: 25rpx; text-align: center; width: 350rpx;height: 50rpx;line-height: 50rpx;">
				人工客服
			</view> -->
    </view>
    <!-- 温馨提示 -->
    <view class="p-4">
      <!-- 标题 -->
      <text class="font-weight-bold font-md">温馨提示:</text>
      <!-- 内容 -->
      <view v-for="(item, i) in data" :key="item.id" class="font-sm mt-2"
        >{{ item.id }}.{{ item.text
        }}<text class="font-weight-bold text-green">{{
          item.imptext
        }}</text></view
      >
      <view class="font text-center mt-2" @click="goserve('/pages/serves/customerServiceHistory')">历史记录</view>
    </view>
  </view>
</template>

<script>
const app = getApp();
export default {
  data() {
    return {
      Domain_ICON: app.globalData.Domain_ICON, //全局变量域名
      PhoneData: ["15046006120", "15146557172"],
      data: [
        {
          id: 1,
          text: "在线客服 工作时间为每天",
          imptext: "09:00~22:00",
        },
        {
          id: 2,
          text: "400电话工作时间为每天",
          imptext: "07:30~23:30",
        },
      ],
    };
  },
  methods: {
    goserve(url) {
      uni.navigateTo({
        url,
      });
    },
    callPhone() {
      var _this = this;
      var random = parseInt(Math.random() * _this.PhoneData.length);
      console.log(random);
      uni.showModal({
        title: "拨打人工客服电话",
        content: "确认给客服人员拨打电话吗?",
        success: function (res) {
          if (res.confirm) {
            //调用微信拨打电话
            uni.makePhoneCall({
              phoneNumber: "15046006120",
              fail: () => {
                uni.showToast({
                  title: "期待您的来电",
                  icon: "none",
                });
              },
            });
          } else {
            console.log(1);
          }
        },
      });
    },

  },
};
</script>

<style>
</style>
